﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace graphicsdemo
{
    public class Triangle:Graphics
    {
        private double s;
        private double h;

        public double S { get => s; set => s = value; }
        public double H { get => h; set => h = value; }
        public Triangle(double s, double h)
        {
            S = s;
            H = h;
        }
        public override bool IfEffect()
        {
            if (S <= 0 || H <= 0)
                return false;
            else
                return true;
        }
        public override double GetArea()
        {
            if (IfEffect())
                return 0.5 * S * H;
            else
                return 0;
        }
        public override void Show()
        {
            Console.WriteLine("这个形状是三角形，面积为" + GetArea());
        }
    }
}
